#ifndef __HTTP__
#define __HTTP__

#include "windows.h"
#include "WININET.h"
#include "String.h"

#pragma comment(lib, "wininet.lib")

class http
{
private:
	HINTERNET hI;
	HINTERNET hR;
	HINTERNET hS;
	AStr Method;
	int f;
	
	void ClearHandles();
	bool Init(AStr Url, AStr Proxy, bool isPost);
public:
	http(AStr Url, AStr Proxy="", bool isPost=false){ f=Init(Url,Proxy,isPost); }
	http(){ f=0; }
	~http();
	AStr GetUrl(AStr Url);
	AStr Request(AStr r="",AStr Hdr="");
	AStr GetCookie(AStr& URL);
	bool isConnected() { return (f != 0); }
	
};

AStr GetUrl(const AStr& Url);
AStr PostUrl(const AStr& Url, const AStr& PostData);

#endif
